<% user_data = {
     :lon => contact.home_lon,
     :lat => contact.home_lat,
     :icon => type == "following" ? "MARKER_BLUE" : "MARKER_GREEN",
     :description => render(:partial => "popup", :object => contact, :locals => { :type => type })
   } %>
<%= tag.div :class => "row", :data => { :user => user_data } do %>
  <div class="col-auto">
    <%= user_thumbnail contact %>
  </div>
  <div class="col">
    <p class='text-body-secondary mb-0'>
      <%= link_to contact.display_name, contact %>
      <% if current_user.home_location? and contact.home_location? %>
        <% distance = current_user.distance(contact) %>
        <% if distance < 1 %>
          (<%= t ".m away", :count => (distance * 1000).round %>)
        <% else %>
          (<%= t ".km away", :count => distance.round %>)
        <% end %>
      <% end %>
    </p>
    <p class="mb-0">
      <% changeset = contact.changesets.first %>
      <% if changeset %>
        <%= t(".latest_edit_html", :ago => friendly_date_ago(changeset.created_at)) %>
        <% comment = changeset.tags["comment"].to_s == "" ? t("browse.no_comment") : changeset.tags["comment"] %>
        <q><%= link_to comment, changeset, :title => t(".view_changeset_details") %></q>
      <% else %>
       <%= t ".no_edits" %>
      <% end %>
    </p>

    <nav class='secondary-actions'>
      <ul class='text-body-secondary'>
        <li><%= link_to t("users.show.send message"), new_message_path(contact) %></li>
        <li>
          <% if current_user.follows?(contact) %>
            <%= link_to t("users.show.unfollow"), follow_path(contact, :referer => request.fullpath), :method => :delete %>
          <% else %>
            <%= link_to t("users.show.follow"), follow_path(contact, :referer => request.fullpath), :method => :post %>
          <% end %>
        </li>
      </ul>
    </nav>
  </div>
<% end %>
